/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nms.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author mohamedemara
 */
@Entity
@Table(name = "LOGON")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Logon.findAll", query = "SELECT l FROM Logon l"),
    @NamedQuery(name = "Logon.findByUserName", query = "SELECT l FROM Logon l WHERE l.userName = :userName"),
    @NamedQuery(name = "Logon.findByUserPassword", query = "SELECT l FROM Logon l WHERE l.userPassword = :userPassword")})
public class Logon implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 15)
    @Column(name = "user_name")
    private String userName;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 15)
    @Column(name = "user_password")
    private String userPassword;

    public Logon() {
    }

    public Logon(String userName) {
        this.userName = userName;
    }

    public Logon(String userName, String userPassword) {
        this.userName = userName;
        this.userPassword = userPassword;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserPassword() {
        return userPassword;
    }

    public void setUserPassword(String userPassword) {
        this.userPassword = userPassword;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (userName != null ? userName.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Logon)) {
            return false;
        }
        Logon other = (Logon) object;
        if ((this.userName == null && other.userName != null) || (this.userName != null && !this.userName.equals(other.userName))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.nms.entities.Logon[ userName=" + userName + " ]";
    }
    
}
